<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.EditCommandeTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:panelGroup styleClass="edit" layout="block">
                <h:panelGrid columns="2">
                    <h:outputLabel value="#{bundle.EditCommandeLabel_idCommande}" for="idCommande" />
                    <h:inputText id="idCommande" value="#{commandeController.selected.idCommande}" 
                                 title="#{bundle.EditCommandeTitle_idCommande}" required="true" 
                                 requiredMessage="#{bundle.EditCommandeRequiredMessage_idCommande}"
                                 disabled="true"/>
                    <h:outputLabel value="#{bundle.EditCommandeLabel_dateCommande}" for="dateCommande" />
                    <h:inputText id="dateCommande" value="#{commandeController.selected.dateCommande}" 
                                 title="#{bundle.EditCommandeTitle_dateCommande}" required="true" 
                                 requiredMessage="#{bundle.EditCommandeRequiredMessage_dateCommande}"
                                 disabled="true">
                        <f:convertDateTime pattern="dd/MM/yyyy HH:mm:ss" />
                    </h:inputText>
                    <h:outputLabel value="#{bundle.EditCommandeLabel_dateLivraison}" for="dateLivraison" />
                    <h:inputText id="dateLivraison" value="#{commandeController.selected.dateLivraison}" title="#{bundle.EditCommandeTitle_dateLivraison}" required="true" requiredMessage="#{bundle.EditCommandeRequiredMessage_dateLivraison}">
                        <f:convertDateTime pattern="dd/MM/yyyy HH:mm:ss" />
                    </h:inputText>
                    <h:outputLabel value="#{bundle.EditCommandeLabel_montant}" for="montant" />
                    <h:inputText id="montant" value="#{commandeController.selected.montant}" 
                                 title="#{bundle.EditCommandeTitle_montant}" required="true" 
                                 requiredMessage="#{bundle.EditCommandeRequiredMessage_montant}"
                                 disabled="true"/>
                    <h:outputLabel value="#{bundle.EditCommandeLabel_idStatut}" for="idStatut" />



                    <h:selectOneMenu id="idStatut" value="#{commandeController.selected.idStatut}" 
                                     title="#{bundle.EditCommandeTitle_idStatut}" required="true" 
                                     requiredMessage="#{bundle.EditCommandeRequiredMessage_idStatut}"
                                     onchange="submit()"
                                     valueChangeListener="#{commandeController.valueChangeMethod}">
                        <f:selectItems value="#{statutCommandeController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>

                    <h:outputLabel value="#{bundle.EditCommandeLabel_raisonRefus}" for="raisonRefus" />
                    <h:inputText id="raisonRefus" value="#{commandeController.selected.raisonRefus}" 
                                 title="#{bundle.EditCommandeTitle_raisonRefus}" 
                                 disabled="#{commandeController.disabled}"
                                 required="#{commandeController.refusRequired}"
                                 requiredMessage="#{bundle.EditCommandeRequiredMessage_raisonRefus}"
                                 />


                    <h:outputLabel value="#{bundle.EditCommandeLabel_idAdresse}" for="idAdresse" />
                    <h:selectOneMenu id="idAdresse" value="#{commandeController.selected.idAdresse}" 
                                     title="#{bundle.EditCommandeTitle_idAdresse}" required="true" 
                                     requiredMessage="#{bundle.EditCommandeRequiredMessage_idAdresse}"
                                     disabled="true">
                        <f:selectItems value="#{adresseController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>
                    <h:outputLabel value="#{bundle.EditCommandeLabel_idClient}" for="idClient" />
                    <h:selectOneMenu id="idClient" value="#{commandeController.selected.idClient}" 
                                     title="#{bundle.EditCommandeTitle_idClient}" required="true" 
                                     requiredMessage="#{bundle.EditCommandeRequiredMessage_idClient}"
                                     disabled="true">
                        <f:selectItems value="#{clientController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>
                    <h:outputLabel value="#{bundle.EditCommandeLabel_idRestaurant}" for="idRestaurant" />
                    <h:selectOneMenu id="idRestaurant" value="#{commandeController.selected.idRestaurant}" 
                                     title="#{bundle.EditCommandeTitle_idRestaurant}" required="true" 
                                     requiredMessage="#{bundle.EditCommandeRequiredMessage_idRestaurant}"
                                     disabled="true">
                        <f:selectItems value="#{restaurantController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>
                </h:panelGrid>
                <h:panelGroup styleClass="boutons" layout="block">
                    <br />
                    <h:commandLink styleClass="enregistrer" action="#{commandeController.update}" value="#{bundle.EditCommandeSaveLink}"/>
                    <br />
                    <br />
                    <h:commandLink styleClass="retour" action="#{commandeController.prepareList}" value="#{bundle.EditCommandeShowAllLink}" immediate="true"/>
                </h:panelGroup>
            </h:panelGroup>
        </ui:define>
    </ui:composition>

</html>
